Function.prototype.callBack = function (...args) {
    if (args.length) {
        let scope = args.shift(), _fnBackFn = Symbol();
        Object.defineProperty(scope, _fnBackFn, {
            enumerable: false,
            value: this
        });
        scope[_fnBackFn](...args);
    } else {
        this(...args);
    }

}

Function.prototype.applyBack = function (...args) {
    if (args.length) {
        let scope = args.shift(), _fnBackFn = Symbol();
        Object.defineProperty(scope, _fnBackFn, {
            enumerable: false,
            value: this
        });
        args = args.length ? args[0] : [undefined];
        if (Array.isArray(args)) {
            scope[_fnBackFn](...args);
        } else {
            throw new TypeError("传入参数类型不正确, 应传入数组类型");
        }
    } else {
        this(...args);
    }
}



function fn(ag, bg) {
    console.log(ag, bg);
}


fn.callBack({ name: "dom", _fnBackFn: "call" }, "args", "call");
fn.callBack(fn, "args", "call");

// fn.apply({ name: "dom", _fnBackFn: "call" }, "module");
fn.applyBack({ name: "dom", _fnBackFn: "call" }, "module");
fn.applyBack({ name: "dom", _fnBackFn: "call" }, ["module", "call"]);
fn.applyBack({ name: "dom", _fnBackFn: "call" });